package com.hwadee.caixiang.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hwadee.caixiang.entity.Category;
import com.hwadee.caixiang.service.CategoryService;

@Controller
public class HomeController {
	@Autowired
	private CategoryService categoryService;

	@RequestMapping("/index")
	public @ResponseBody List<Category> index(HttpSession session) throws Exception {
		List<Category> categoryList = categoryService.findAllCategory();
		session.setAttribute("categoryList", categoryList);

		return categoryList;
	}

}
